home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 734 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.8 KB

  1. From: raviyer@nt.com
  2. Message-ID: <4icihu$e3d@nrchh52.rich.nt.com>
  3. X-Original-Date: Fri, 15 Mar 1996 20:02:14 +0000
  4. Path: in2.uu.net!bounce-back
  5. Date: 16 Mar 96 06:04:34 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Return-Path: <daemon@meeker.UCAR.EDU>
  8. Subject: enums and conversion question
  9. Newsgroups: comp.std.c++
  10. Organization: Northern Telecom Inc., Mission Park
  11. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  12.     iQBFAgUBMUpaEuEDnX0m9pzZAQGJjgF/Q8HmNIJVoN5m4K1WtGQhukaguiMJAhL5
  13.     W7wV8W1cA8yoRy9BXi7Uc9OCbgAPmr7O
  14.     =Lej1
  15.  
  16. Hi,
  17.  
  18. I have the following piece of code,
  19.  
  20. void goo(int);
  21. void goo(unsigned int);
  22.  
  23. enum Enum {E1,E2}
  24.  
  25. void foo ()
  26. {
  27.     Enum e = E1;
  28.     goo(e); // Is this call ambiguos?
  29. }
  30.  
  31. The DWP in 4.5 (integral promotion) point 2 says that 
  32. "An rvalue of type wchar_t or an enumeration type can be converted to an
  33. rvalue of the _first_ of the following types that can represent all the values
  34. of the source type: int, unsigned int, long, unsigned long."
  35.  
  36. Does this mean that in the above example the call to goo(e) should be resolved
  37. to goo(int)? or in other words is the promotion enum -> int better than 
  38. enum -> unsigned int in this case?
  39.  
  40. thanks in advance
  41. -- 
  42. |#include <stddisclaimers.h> // My own views                                |
  43. |Ravikant Iyer. aka - ravi - raviyer@nt.com                                 |
  44. |Nortel. Santa Clara CA. Off: 408-565-7430                                  |
  45. |                               ESN-655-7430.                               |
  46. ---
  47. [ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
  48. [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
  49. [ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
  50. [ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
  51. [ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
  52.